package com.bank;

import org.apache.catalina.filters.CorsFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

import javax.servlet.http.HttpServletResponse;


@SpringBootApplication
public class BankApplication {

    public static void main(String[] args) {
        SpringApplication.run(BankApplication.class, args);
    }


/*    private void setResponseMation(HttpServletResponse servletResponse) {
        servletResponse.setCharacterEncoding("UTF-8");
        servletResponse.setContentType("text/html;charset=UTF-8");
        servletResponse.setHeader("Access-Control-Allow-Origin", "*");
        servletResponse.setHeader("Access-Control-Allow-Credentials", "true");
        servletResponse.setHeader("Access-Control-Allow-Methods", "*");
        // userToken为用户的token
        // requestType为请求类型，2为手机端请求，1或者空为PC端请求
        servletResponse.setHeader("Access-Control-Allow-Headers", "Content-Type,token,loginPCIp,useridentity," +
            "requestType,x-prototype-version,x-requested-with,X_Requested_With");
        // 解决跨域时，前台控制台报 Refused to get unsafe header的错
        servletResponse.addHeader("Access-Control-Expose-Headers", "SESSIONSTATUS,REQUESTMATION,X-JSON");
        servletResponse.setHeader("Set-Cookie", "HttpOnly;Secure;SameSite=None");
    }*/
}
